<div class="container type1">
		<h1>Thu chi</h1>
<style type="text/css">
	.container{
		float: none;
	}
	.container form{
		margin:10px;
	}
	
#lietke {
    background: url("<?php echo base_url();?>resources/images/btn.png") no-repeat scroll 0 0 transparent;
    color: #000000;
    float: left;
    height: 25px;
    padding-left: 14px;
    padding-top: 3px;
    position: relative;
    width: 60px;
}
#btnIN{float:left;margin-top:2px;cursor:pointer;}
.container input{
	background-color: #DDDDDD;
    border: medium none;
    margin-left: 5px;
    padding: 3px;
}
.filter{
	 background: url("<?php echo base_url();?>resources/images/dropdown.png") no-repeat scroll right center #DDDDDD;
    border: 0 none;
    float: left;
    height: 28px;
    overflow: hidden;
    width: 200px;
}
.filter select {
    background: none repeat scroll 0 0 transparent;
    border: medium none;
    border-radius: 1px 1px 1px 1px;
    line-height: 1;
    padding: 5px;
    width: 225px;
}
.cm{
	clear: both; float: left;
	margin-top:5px;
}
td.tdtype1{
		 background-color: #CCCCCC;
		border-bottom: 1px dashed;
		color: #000000;
		font-weight: bold;
		text-align: right;
	}
</style>		
<script type="text/javascript">
 $(function() {
	$("#lietke").click(function(event){
		event.preventDefault();
		$("form#frm_thuchi").submit();
	});
	$( "#thuchi_dt_from" ).datepicker({
			showOn: "button",
			changeYear:true,
			changeMonth:true,
			buttonImage: "<?php echo base_url();?>resources/images/calendar.gif",
			buttonImageOnly: true,
			dateFormat: 'dd/mm/yy'
		}).change(function(){
			
		});
	$( "#thuchi_dt_to" ).datepicker({
			showOn: "button",
			changeYear:true,
			changeMonth:true,
			buttonImage: "<?php echo base_url();?>resources/images/calendar.gif",
			buttonImageOnly: true,
			dateFormat: 'dd/mm/yy'
		}).change(function(){
			
		});
	$("select[name='theo']").change(function(){
		var type = $("select[name='theo'] option:selected").val();
		if(type=="CM"){
			$('.filter_thang').css("display","none");
			$('.cm').css("display","block");
		}else{
			$('.filter_thang').css("display","inline");
			$('.cm').css("display","none");
		}
	});
	$("select[name='theo']").change();
 });
 
</script>
	<?php echo form_open(current_url(),"id='frm_thuchi'"); ?>	
	<span style="margin: 0px auto; width: 450px;">	
	<span style="float:left;">Chọn:</span> <div class="filter"><?php echo $combobox_cats;?></div>
	<span style="float:left; margin-top:2px;" class='filter_thang'><input id="thuchi_dt" type="text" name="thuchi_dt" value="<?php echo $time;?>"  /></span>
	<span class="cm">
	From<input id="thuchi_dt_from" type="text" name="thuchi_dt_from" value="<?php echo $time_from;?>"  />
	To<input id="thuchi_dt_to" type="text" name="thuchi_dt_to" value="<?php echo $time_to;?>"  />
	</span>
	</span>
	<span style="margin: 10px auto 0px; width: 125px;clear:both;">
	 <a href="<?php echo current_url();?>" id="lietke">Liệt kê</a>
	<input type="button" id="btnIN" value="In" onclick="printPartOfPage('IN');" />
	</span>
	<div style="clear:both;"></div>
	<?php echo form_close(); ?>	
	<div id="IN">
<table id="">
	<tr>
		<th colspan="11" class="both" valign="left" style="text-align:left">Tháng <?php echo $thang;?></td> 
	</tr>
	<tr>
		<th class="both" colspan="11" valign="left" style="text-align:left;">Lương</td> 
	</tr>
	<tr style="font-weight:bold; font-size:16px;">
			<th class="first border-right" style="border-right: solid 3px #fff;">Stt</th>
			<th class="border-right" style="border-right: solid 3px #fff;">Tên</th>
			<th class="border-right" style="border-right: solid 3px #fff;" colspan="3">Lương</th>
			<th class="border-right" style="border-right: solid 3px #fff;" colspan="3">Tien dv</th>			
			<th class="last" colspan="3">Thanh tien</th>			
	</tr>
	<?php 
	$sum_luong = 0; $sum_bonus = 0;$i = 1; $sum_tong = 0;
	foreach($luong as $item){
		$sum_luong += $item['thanhtien']*1000 ;
		$class="";
		if($i%2==0) $class="odd";
	?>
	<tr class="<?php echo $class;?>" style="font-weight:bold; font-size:16px;">
			<td><?php echo $i;?></td>
			<td><?php echo $item['Personal_ID'];?></td>
			<td colspan="3" class="money"><?php echo formatcurrency($item['Salary']*1000);?></td>
			<td colspan="3" class="money"><?php echo formatcurrency($item['Price_Serv']*1000);?></td>
			<td colspan="3" class="money"><?php echo formatcurrency($item['thanhtien']*1000);?></td>
	</tr>
	<?php 
	$i = $i+1;
	} ?>
	<tr style="font-weight:bold; font-size:16px;">
			<td colspan="2" class="tdtype1" style='border-top: 1px dashed;'>Tổng</td>
			<td colspan="9" class="money tdtype1" style='border-top: 1px dashed;'><?php echo formatcurrency($sum_luong);?></td>
	</tr>
	<tr>
		<th class="both" colspan="11" valign="left" style="text-align:left;">Chi phí phát sinh</td> 
	</tr>
	<tr style="font-weight:bold; font-size:16px;">
			<th class="first border-right" style="border-right: solid 3px #fff;">Stt</th>
			<th class="border-right" style="border-right: solid 3px #fff;" colspan="5">Nội dung</th>
			<th class="last" colspan="5">Tiền</th>
	</tr>
	<?php 
	$sum_phatsinh = 0; $i = 1;
	foreach($phatsinh as $item){
		$sum_phatsinh += $item['Price']*1000;
	?>
	<tr style="font-weight:bold; font-size:16px;">
			<td><?php echo $i;?></td>
			<td colspan="5"><?php echo $item["Content"];?></td>
			<td colspan="5" class="money"><?php echo formatcurrency($item["Price"]*1000);?></td>
	</tr>
	<?php 
	$i = $i+1;
	} ?>
	<tr style="font-weight:bold; font-size:16px;">			
			<td colspan="6" class='tdtype1' style='border-top: 1px dashed;'>Tổng</td>
			<td colspan="5" class="money tdtype1" style='border-top: 1px dashed;'><?php echo formatcurrency($sum_phatsinh);?></td>
	</tr>
	<tr style="font-weight:bold; font-size:16px;">			
			<td colspan="6" class='tdtype1' style="">Tiền típ</td>
			<td colspan="5"  style="" class="money tdtype1"><?php echo formatcurrency(($tientip*1000));?></td>
	</tr>
	<tr style="font-weight:bold; font-size:16px;">			
			<td colspan="6" class='tdtype1'>Chi</td>
			<td colspan="5" class="money tdtype1"><?php echo formatcurrency(($sum_phatsinh + $sum_luong + $tientip*1000));?></td>
	</tr>
	<tr style="font-weight:bold; font-size:16px;">			
			<td colspan="6" class='tdtype1'>Thu</td>
			<td colspan="5" class="money tdtype1"><?php echo formatcurrency($thu*1000);?></td>
	</tr>
	<tr style="font-weight:bold; font-size:16px;">			
			<td colspan="6" class='tdtype1'>Dư</td>
			<td colspan="5" class="money tdtype1"><?php echo formatcurrency(($thu*1000-($sum_phatsinh + $sum_luong + $tientip*1000)));?></td>
	</tr>
</table>
</div>
</div>

	<style>
/* 
.ui-datepicker-calendar {
    display: none;
    }
*/
</style>